mui.init();
//mui.init({
//	pullRefresh: {
//		container: "#index_new_hot", //待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
//		up: {
//			height: 50, // 可选.默认50.触发上拉加载拖动距离
//			auto: true, // 可选,默认false.自动上拉加载一次
//			contentrefresh: "正在加载...", // 可选，正在加载状态时，上拉加载控件上显示的标题内容
//			contentnomore: '没有更多的数据了', // 可选，请求完毕若没有更多数据时显示的提醒内容；
//			callback: pullupRefresh //加载数据方法 
//		}
//	}
//})

//获取本地信息
var my_phone = localStorage.getItem("my_phone");
var user_id = localStorage.getItem("user_id");
var mask = mui.createMask(); //遮罩层
//全局变量
var is_realname, status_user, receiver_state, user_phone; //实名状态
//底部菜单栏的页面跳转
//去购物车
$(document).on('tap', '#Shopping_Cart', function() {
	if(user_id == null) {
		mui.openWindow({
			url: "html/user/login.html",
			createNew: true
		})
	} else if(status_user == 2) {
		window.top.location.href = 'html/Shopping_Cart/Shopping_Cart.html';
		//		mui.openWindow({
		//			url: "html/user/login.html",
		//			createNew: true
		//		})
//	} else if(!receiver_state) {
//		mui.openWindow({
//			url: 'html/user/binding_region.html',
//			extras: {
//				my_phone: my_phone,
//				is_realname: is_realname
//			},
//			createNew: true
//		})
//	} else if(!user_phone) {
//		mui.openWindow({
//			url: "html/user/certified_cell_phone_num.html",
//			extras: {
//				is_realname: is_realname
//			},
//			createNew: true
//		})
	} else {
		window.top.location.href = 'html/Shopping_Cart/Shopping_Cart.html';
	}
})

//商品详情
//mui("body").on("tap", "#h5-test", function() {
//	mui.openWindow({
//		url: "h5/home.html?d=20",
//		createNew: true
//	})
//});


//去个人中心
$(document).on('tap', '#my_user', function() {
	if(user_id == null) {
		mui.openWindow({
			url: "html/user/login.html",
			createNew: true
		})
	} else if(status_user == 2) {
		window.top.location.href = 'html/my/my_user.html';
		//		mui.openWindow({
		//			url: "html/user/login.html",
		//			createNew: true
		//		})
	}
//	else if(!receiver_state) {
//		mui.openWindow({
//			url: 'html/user/binding_region.html',
//			extras: {
//				my_phone: my_phone,
//				is_realname: is_realname
//			},
//			createNew: true
//		})
//	} else if(!user_phone) {
//		mui.openWindow({
//			url: "certified_cell_phone_num.html",
//			extras: {
//				is_realname: is_realname
//			},
//			createNew: true
//		})
//	}
	else {
		window.top.location.href = 'html/my/my_user.html';
	}
})

//收付款
$(document).on('tap', '#pay_of_pay', function() {
	if(user_id == null) {
		mui.openWindow({
			url: "html/user/login.html",
			createNew: true
		})
	} else {
		window.top.location.href = 'html/index/pay_of_pay.html';
	}
})

//用戶反饋
mui("body").on("tap", "#user_fankui", function() {
	if(user_id == null) {
		mui.openWindow({
			url: "html/user/login.html",
			createNew: true
		})
	} else {
		mui.openWindow({
			url: "html/index/user_feedback.html",
			id: "user_feedback",
			createNew: true
		})
	}

});

//菜单点击跳转页面
mui('body').on('tap', '.mui-tab-item', function() {
	window.top.location.href = this.href;
	//	$(this).addClass("mui-active");
});

//礼品区、兑换区、跨港通跳转页面
mui("body").on("tap", ".partition", function() {
	//	var leaber = $(this).attr("leaber");
	window.top.location.href = 'html/index/ornament.html'
	
});

//扶贫跳转页面
mui("body").on("tap", ".alleviation", function() {
	//	var leaber = $(this).attr("leaber");
	window.top.location.href = 'html/index/alleviation.html'
	
});
//全部分类
mui("body").on("tap", "#Share_money", function() {
	mui.openWindow({
		url: "html/index/all_categories.html"
	})
});

//商品详情
mui("body").on("tap", ".region_list_area", function() {
	var commodity_id = $(this).attr("commodity_id");
	mui.openWindow({
		url: "html/index/commodity_details.html",
		id: "commodity_details",
		extras: {
			commodity_id: commodity_id
		},
		createNew: true
	})
});

//搜索跳转
mui('body').on('tap', '.earch', function() {
	mui.openWindow({
		url: "html/index/all_search.html",
		id: "all_search.html",
	})
});
//消息通告上下轮播
function timer(opj) {
	$(opj).find('ul').animate({
		marginTop: "-3.5rem"
	}, 500, function() {
		$(this).css({
			marginTop: "0.7rem"
		}).find("li:first").appendTo(this);
	})
}
$(function() {
	var num = $('.home_notice').find('li').length;
	if(num > 1) {
		var time = setInterval('timer(".home_notice")', 3500);
	}
});
//消息通告第一条
function findSystemNotices() {
	mui.ajax(user_url + '/notice/findSystemNotices', {
		data: {
			"limit": 2,
			"page": 1,
			"phone": "string",
			"sign": "string",
			"user_id": 0
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			if(data.code == 10000) {
				var html = '';
				for(var i = 0; i < data.resp.length; i++) {
					html += '<li class="notice_list"><i class="icon-tongzhi"></i>公告：<span class="notice_title" leaber_id="' + data.resp[i].id + '">' + data.resp[i].title + '</span></li>	'
				}
				$("#notice_ul").html(html);
				$("#notice_ul li:nth-of-type(1)").addClass("notice_list");
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg)
		}
	});
}
//公告到公告详情页
$(document).on('tap', '.home_notice', function() {
	var leaber_id = $(".notice_title").attr('leaber_id');
	mui.openWindow({
		url: "html/my/notice_details.html",
		extras: {
			leaber_id: leaber_id
		},
		createNew: true
	})
})
//隐藏菜单
mui("body").on("tap", ".mui-table-view-cell a", function() {
	window.top.location.href = this.href;
});

mui('body').on('tap', '.Scan', function() {
	window.top.location.href = "html/index/Scan.html";
});

mui('.mui-scroll-wrapper').scroll();
mui('body').on('shown', '.mui-popover', function(e) {
	//console.log('shown', e.detail.id);//detail为当前popover元素
});
mui('body').on('hidden', '.mui-popover', function(e) {
	//console.log('hidden', e.detail.id);//detail为当前popover元素
});
window.addEventListener('refresh_method', function(e) { //执行刷新
	location.reload();
});
//特惠区
mui("body").on("tap", "#thq", function() {
	mui.openWindow({
		url: 'html/index/preferential.html',
		id: 'preferential',
		createNew: true
	})
	//	window.top.location.href = "html/index/preferential.html";
});

//悦惠专区
function yuethui_area() {
	mui.ajax(goods_url + '/goods/findItemAreaDetailsList', {
		data: {
			"sign": "string",
			"area_id": 4
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			if(data.code == 10000) {
				if(data.resp != "") {
					var html = '';
					for(var i = 0; i < data.resp.length; i++) {
						html += '<li class="region_list_gifts mui-col-xs-6" title="' + data.resp[i].gift_name + '" commodity_id=' + data.resp[i].id + '>';
						html += '<img width="100%" src=' + data.resp[i].url + data.resp[i].gift_img + '>';
						html += '<p>' + data.resp[i].gift_name + '</p>';
						//						html += '<span> ¥' + data.resp[i].price + '</span>';
						html += '</li>';
					}
					$("#yuethui_area").html(html);
				} else {
					$("#yuethui_area").html("<div style='line-height:90px;text-align:center;color:#C0C0C0;font-size:16px;'>暂无兑换商品信息</div>");
				}
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg)
		}
	});

}
//兑换区
function itemPartitionList_exchange() {
	mui.ajax(goods_url + '/goods/itemPartitionList', {
		data: {
			"limit": 3,
			"page": 1,
			"partition_type": 2,
			"phone": my_phone,
			"sign": "string",
			"user_id": user_id
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			if(data.code == 10000) {
				if(data.resp != "") {
					var html = '';
					for(var i = 0; i < data.resp.length; i++) {
						html += '<li class="region_list region_list_area" commodity_id=' + data.resp[i].id + '>';
						html += '<img width="100%" height="100px" src=' + data.resp[i].url + data.resp[i].image + '>';
						html += '<p>' + data.resp[i].title + '</p>';
						html += '<span> ¥' + data.resp[i].price + '</span>';
						html += '</li>';
					}
					$("#exchange_area").html(html);
				} else {
					$("#exchange_area").html("<div style='line-height:90px;text-align:center;color:#C0C0C0;font-size:16px;'>暂无兑换商品信息</div>");
				}
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg)
		}
	});
}
//跨港通
function itemPartitionList_Cros_sport() {
	mui.ajax(goods_url + '/goods/itemPartitionList', {
		data: {
			"limit": 3,
			"page": 1,
			"partition_type": 3,
			"phone": my_phone,
			"sign": "string",
			"user_id": user_id
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			if(data.code == 10000) {
				if(data.resp != "") {
					var html = '';
					for(var i = 0; i < data.resp.length; i++) {
						html += '<li class="region_list region_list_area" commodity_id=' + data.resp[i].id + '>';
						html += '<img width="100%" height="100px" src=' + data.resp[i].url + data.resp[i].image + '>';
						html += '<p>' + data.resp[i].title + '</p>';
						html += '<span> ¥' + data.resp[i].price + '</span>';
						html += '</li>';
					}
					$("#Cros_sport_area").html(html);
				} else {
					$("#Cros_sport_area").html("<div style='line-height:90px;text-align:center;color:#C0C0C0;font-size:16px;'>暂无跨港通商品信息</div>");
				}

			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg);
		}
	});
}
//轮播图接口调用
function findBannerList() {
	mui.ajax(user_url + '/api/findBannerList', {
		data: {},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			// console.log(JSON.stringify(data))
			if(data.code == 10000) {
				var html = '';
				var html2 = '<div class="mui-indicator mui-active"></div>';
				for(var i = 0; i < data.resp.length; i++) {
					$("#frist_img").attr('src', data.resp[0].image_url_str);
					$("#last_img").attr('src', data.resp[i].image_url_str)
					html += '<div class="mui-slider-item">';
					html += '<a href="#"><img src=' + data.resp[i].image_url_str + '></a>';
					html += '</div>';
				}
				for(var i = 1; i < data.resp.length; i++) {
					html2 += '<div class="mui-indicator"></div>';
				}
				$("#frist_img_box").before(html);
				$("#index_dian").html(html2);
				var gallery = mui('.mui-slider');
				gallery.slider({
					interval: 2000 //自动轮播周期，若为0则不自动播放，默认为0；
				});
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg)
		}
	});
}
//热销商品
var pagenum = 1; //页数
var pagesize = 20; //每页条数
var isOver = false; //是否加载完 
var listTui = [];
function commodity() {
//	plus.nativeUI.showWaiting("加载中...");
//	mask.show(); //显示遮罩层	
	mui.ajax(goods_url + '/api/index/index', {
		data:{
			page:pagenum
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		success: function(data) {
			
			// console.log(JSON.stringify(data))			
//			plus.nativeUI.closeWaiting(); //关闭等待
//			mask.close(); //关闭遮罩层
			if(data.code == 100) {
				
				// 推荐商品
				var htmlTui = "";				
				var p = data.resp.goodsList.total / pagesize; //总页数
//				if(pagenum >= p) { //当前的页数
//					isOver = true;
//					mui('#index_new_hot').pullRefresh().endPullupToRefresh(true);
//				}
//				if(isOver == false) {
//					pagenum++;
//					mui('#index_new_hot').pullRefresh().endPullupToRefresh(true); //停止正在加载
//					mui('#index_new_hot').pullRefresh().enablePullupToRefresh(); //显示上拉加载文字
//				}
				
				var tuiShop = data.resp.goodsList.data;
				listTui = listTui.concat(tuiShop);				
				console.log('推荐商品');
				console.log(JSON.stringify(listTui))
				for(var a = 0; a < listTui.length; a++) {
					if(listTui[a]!=null){
						htmlTui += '<li class="recommended mui-col-xs-6" commodity_id=' + listTui[a].goods_id + '>';
						if(listTui[a].album_picture==null){
							htmlTui += '<img width="100%" src="images/index_new_hot1.png">';
						}
						else{
							htmlTui += '<img width="100%" style="height:130px" src=' + goods_url + listTui[a].album_picture.pic_cover_small + '>';
						}						
						htmlTui += '<div>';
						htmlTui += '<span>' + listTui[a].goods_name + '</span>';
						htmlTui += '<p>¥<span>' + listTui[a].price + '</span><i>' + listTui[a].promotion_price + '</i></p>';
						htmlTui += '</div>';
						htmlTui += '</li>';
					}					
				}
				$("#index_new_hot").html(htmlTui);
				
				console.log('代售专区');
				console.log(JSON.stringify(data.resp.replaceList));
				var dataDai = data.resp.replaceList;
				var htmlDai = "";
				for(var b = 0; b < dataDai.length; b++) {
					if(dataDai[b]!=null){
						htmlDai += '<li class="sell_list mui-col-xs-6" commodity_id=' + dataDai[b].goods_id + ' sell_id=' + dataDai[b].replace_sell_id + '>';
						if(dataDai[b].album_picture==null){
							htmlDai += '<img width="100%" src="images/index_new_hot1.png">';
						}
						else{
							htmlDai += '<img width="100%" style="height:130px" src=' + goods_url + dataDai[b].album_picture.pic_cover_small + '>';
						}						
						htmlDai += '<div>';
						htmlDai += '<span>' + dataDai[b].goods_name + '</span>';
						htmlDai += '<p>¥<span>' + dataDai[b].price + '</span><i>' + dataDai[b].promotion_price + '</i></p>';
						htmlDai += '</div>';
						htmlDai += '</li>';
					}					
				}
				$("#gift_area").html(htmlDai);
				
      			
      			//银饰专区
				var html = ""
				var hotShop = data.resp.silverZoneList;
				console.log('银饰专区');
				console.log(JSON.stringify(data.resp.silverZoneList));
				for(var i = 0; i < hotShop.length; i++) {
					html += '<div class="hot_pin swiper-slide" commodity_id=' + hotShop[i].goods_id + '>';
					if(hotShop[i].album_picture==null){
						htmlTui += '<img width="100%" src="images/index_new_hot1.png">';
					}
					else{
						html += '<img width="100%" style="height:130px" src=' + goods_url + hotShop[i].album_picture.pic_cover + '>';
					}					
					html += '<div>';
					html += '<span>' + hotShop[i].goods_name + '</span>';
					html += '<p>¥<span>' + hotShop[i].price + '</span></p>';
					html += '</div>';
					html += '</div>'
				}
				$("#index_new_hot_list").html(html);				
				var swiper = new Swiper('.swiper-container', {
			      slidesPerView: 3,
			      spaceBetween: 0
			    });
			    			    
				
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log('热销商品接口失败');
		}
	});
}
//选项卡，推荐商品、代售专区
mui("body").on("tap", ".tab_1", function() {
	$("#index_new_hot").show();
	$("#gift_area").hide();	
	$(".tab_1").addClass('on');
	$(".tab_2").removeClass('on');
});
mui("body").on("tap", ".tab_2", function() {
	$("#index_new_hot").hide();
	$("#gift_area").show();
	$(".tab_1").removeClass('on');
	$(".tab_2").addClass('on');
});

function commodityFirst() {		
	mui.ajax(goods_url + '/api/index/index', {
		data:{
			page:pagenum
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		success: function(data) {
			console.log('热销商品接口成功');
			console.log(JSON.stringify(data))
//			plus.nativeUI.closeWaiting(); //关闭等待
//			mask.close(); //关闭遮罩层
			if(data.code == 100) {
      						
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log('热销商品接口失败');
		}
	});
}

//热销商品
mui("body").on("tap", ".hot_pin", function() {
//	plus.nativeUI.showWaiting("加载中...");
//	mask.show(); //显示遮罩层
	var commodity_id = $(this).attr("commodity_id");
	//alert(commodity_id)
	mui.openWindow({
		url: "html/index/commodity_details.html",
		id: "commodity_details",
		extras: {
			commodity_id: commodity_id
		},
		createNew: true,
		waiting: {
			autoShow: false
		}
	}, mask.close());
});
//推荐商品
function recommend_commodities() {
	mui.ajax(goods_url + '/goods/bestSellers', {
		data: {
			"limit": 3,
			"page": 1,
			"phone": my_phone,
			"sign": "string",
			"type": 2,
			"user_id": user_id
		},
		dataType: 'json', //服务器返回json格式数据
		type: 'post', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		headers: {
			'Content-Type': 'application/json'
		},
		success: function(data) {
			if(data.code == 10000) {
				var html = "";
				for(var i = 0; i < data.resp.length; i++) {
					html += '<li class="recommended mui-col-xs-6" commodity_id=' + data.resp[i].id + '>';
					html += '<img width="100%" src=' + data.resp[i].url + data.resp[i].image + '>';
					html += '<div>';
					html += '<span>' + data.resp[i].title + '</span>';
					html += '<p>¥<span>' + data.resp[i].price + '</span><i>' + (data.resp[i].price + data.resp[i].price * 0.3).toFixed(2) + '</i></p>';
					html += '</div>';
					html += '</li>';
				}
				$("#index_new_hot").html(html);
			}
		},
		error: function(xhr, type, errorThrown) { //异常处理；
			console.log(type);
			var error_msg = JSON.parse(xhr.responseText)
			mui.alert(error_msg.msg)
		}
	});
}

//function pullupRefresh() {
//	setTimeout(function() {
//		mui('#index_new_hot').pullRefresh().disablePullupToRefresh(false);
//		setTimeout(function() {
//			commodity();
//			mui('#index_new_hot').pullRefresh().endPullupToRefresh((isOver)); //参数为true代表没有更多数据了。
//		}, 500);
//	}, 500);
//}

//推荐商品
mui("body").on("tap", ".recommended", function() {
//	plus.nativeUI.showWaiting("加载中...");
//	mask.show(); //显示遮罩层
	var commodity_id = $(this).attr("commodity_id");
	mui.openWindow({
		url: 'html/index/commodity_details.html',
		id: 'commodity_details',
		createNew: true,
		extras: {
			commodity_id: commodity_id
		},
		waiting: {
			autoShow: false
		}
	}, mask.close());
});


//代售商品
mui("body").on("tap", ".sell_list", function() {
//	plus.nativeUI.showWaiting("加载中...");
//	mask.show(); //显示遮罩层
	var commodity_id = $(this).attr("commodity_id");
	var sell_id = $(this).attr("sell_id");
	//alert(commodity_id)
	mui.openWindow({
		url: "html/index/commodity_details.html",
		id: "commodity_details",
		extras: {
			commodity_id: commodity_id,
			sell_id: sell_id
		},
		createNew: true,
		waiting: {
			autoShow: false
		}
	}, mask.close());
});


//页面进入执行方法
window.onload = function() {
//	mui.plusReady(function() {
//		var self = plus.webview.currentWebview();
//		plus.nativeUI.closeWaiting(); //关闭等待
//	});
	
	userInfo()
		
		commodity(); //热销商品	
	
	
	mui.plusReady(function() {
		var gallery = mui('.mui-slider');
		gallery.slider({
			interval: 2000 //自动轮播周期，若为0则不自动播放，默认为0；
		});
		
		
		
//		var self = plus.webview.currentWebview();
//		plus.nativeUI.closeWaiting(); //关闭等待
////		plus.nativeUI.showWaiting("加载中...");
//		mask.show(); //显示遮罩层
		
//		plus.nativeUI.showWaiting("加载中...");
//		mask.show(); //显示遮罩层
		
			
//		recommend_commodities(); //推荐商品
		//itemPartitionList_exchange(); //兑换区
		//itemPartitionList_Cros_sport(); //跨港通
		//		yuethui_area(); //悦惠专区
//		findBannerList(); //轮播图
//		userinfo(); //实名状态
		// findNewEdition(); //热跟新
//		plus.screen.lockOrientation("portrait-primary"); //设置仅为述评
	});
}
//热跟新
// var version='2.0.8';
//function findNewEdition() {
//	mui.ajax(user_url + '/api/version/checkVersion', {
//		data: {
//			version: version
//		},
//		dataType: 'json', //服务器返回json格式数据
//		type: 'get', //HTTP请求类型
//		timeout: 10000, //超时时间设置为10秒；
//		success: function(data) {
//			console.log(JSON.stringify(data))
//			if(data.code == -1){
//				$('#regenxin').attr("data-url", data.resp.file);
//				var html =''
//				for(var i= 0;i<data.resp.content.length ; i++) {
//					html+='<li style="margin-right:15%;">' +data.resp.content[i]+'</li>'
//				}
//				$("#version_cont").html(html);
//				$(".mui-backdrop").show();
//			}else if(data.code == 1){
//				$(".mui-backdrop").hide();
//			}
//		},
//		error: function(xhr, type, errorThrown) {
//			console.log(type);
//		}
//	});
//}

//function downWgt(downloadWgtUrl) {
//	plus.nativeUI.showWaiting("正在更新资源...");
//	plus.downloader.createDownload(downloadWgtUrl, {
//		filename: "_doc/update/"
//	}, function(d, status) {
//		if(status == 200) {
//			console.log("下载wgt成功：" + d.filename);
//			installWgt(d.filename);
//		} else {
//			 plus.nativeUI.alert("下载wgt失败！");
//			console.log("下载wgt失败！");
//		}
//		plus.nativeUI.closeWaiting();
//	}).start();
//}

// 更新应用资源升级包 
//function installWgt(path) {
//	plus.nativeUI.showWaiting("安装文件...");
//	plus.runtime.install(path, {}, function() {
//		plus.nativeUI.closeWaiting();
//		plus.nativeUI.alert("应用资源更新完成！", function() {
//			plus.runtime.restart();
//		});
//	}, function(e) {
//		console.log("安装wgt文件失败["+e.code+"]："+e.message)
//		plus.nativeUI.closeWaiting();
//		plus.nativeUI.alert(JSON.stringify(e));
//	});
//}
//$(document).on('tap', '#regenxin', function() {
//	downWgt($("#regenxin").attr("data-url"));
//})

// 二级按钮退出APP
//var first = null;
//mui.back = function() {
//	//首次按键，提示‘再按一次退出应用’
//	if(!first) {
//		first = new Date().getTime();
//		mui.toast('再按一次退出应用');
//		setTimeout(function() {
//			first = null;
//		}, 1000);
//	} else {
//		if(new Date().getTime() - first < 1000) {
//			plus.runtime.quit();
//		}
//	}
//};
function userInfo(){
	mui.ajax(user_url + '/api/User/getUserInfo',{
		dataType: 'json', //服务器返回json格式数据
		type: 'get', //HTTP请求类型
		timeout: 10000, //超时时间设置为10秒；
		success:function(data){
			console.log(JSON.stringify(data))
			if(data.code == 789){
				var btnArray = ['确定', '取消'];
				mui.confirm('还未登录，请先登录', '温馨提示', btnArray, function(e) {
			        if (e.index == 1) {
			            // console.log('取消');
			        }
			        else {
			            // console.log('确定');
			          window.top.location.href = 'html/user/login.html'
			          localStorage.clear();
			        }
			   })
				
			}
		}
	})
}
